package Text7;
import java.util.*;
public class Main {
    public static int N = 100010,M = N*2,n,m,idx;
    public static int[] h = new int[N],e = new int[M],ne = new int[M];
    public static int[] color = new int[N];
    public static void main(String[] args) {
        Scanner scanner =  new Scanner(System.in);
        n = scanner.nextInt();
        m = scanner.nextInt();
        Arrays.fill(h,-1);
        for (int i = 0; i < m; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            add(a,b);add(b,a);//因为是无向边，所以双方指向双方的两条边
        }
        boolean flag=true;
        for (int i = 1; i <=n ; i++) {
            if(color[i]==0){
                if(!dfs(i,1)){
                    flag=false;
                    break;
                }
            }
        }
        if(!flag){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }

    private static boolean dfs(int k, int c) {
        color[k]=c;
        for (int i = h[k]; i!=-1 ; i=ne[i]) {
            int j=e[i];
            if(color[j]==0){
                if(!dfs(j,3-c)){
                    return false;
                }
            }else{
                if(color[j]==c){
                    return false;
                }
            }
        }
        return true;
    }

    private static void add(int a, int b) {
        e[idx]=b;
        ne[idx]=h[a];
        h[a]=idx++;
    }
}
